package com.jrauto.CarAppBackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jrauto.CarAppBackend.entity.ChatMessage;
import com.jrauto.CarAppBackend.entity.ChatSession;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
* @author huimin
* @description 针对表【chat_session(会话表)】的数据库操作Mapper
* @createDate 2025-09-03 15:29:36
* @Entity generator.domain.ChatSession
*/
public interface ChatSessionMapper extends BaseMapper<ChatSession> {

    /**
     * 根据用户ID获取会话列表
     * @param userId 用户ID
     * @return 会话列表
     */
    @Select("SELECT * FROM chat_session WHERE user_id = #{userId} ORDER BY last_message_time DESC")
    List<ChatSession> findSessionsByUserId(@Param("userId") Integer userId);
}




